#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <stdio.h>

#include "Tcam.h"

namespace vendor {
namespace ecarx {
namespace xma {
namespace tcam {
namespace V1_0 {
namespace gtest {

using testing::_;
using testing::ByMove;
using namespace vendor::ecarx::xma::tcam::V1_0;

constexpr static int DELAY_TIME = 2;

class TcamCallbackTest : public ITcamCallback {
   public:
    // Callback
    MOCK_METHOD9(onPOIInfoNotification,
                 Return<void>(const hidl_string& poiName, int64_t poiLongitude, int64_t poiLatitude,
                              const hidl_string& street, const hidl_string& houseNumber,
                              const hidl_string& city, const hidl_string& region,
                              const hidl_string& postcode, const hidl_string& country));
    MOCK_METHOD3(onXcallStatusNotification,
                 Return<void>(CallType callType, CallStatus callStatus, CallBackMode callBackMode));
    MOCK_METHOD3(onXcallStatusResponse,
                 Return<void>(CallType callType, CallStatus callStatus, CallBackMode callBackMode));
    MOCK_METHOD3(onETAInfoNotification, Return<void>(int32_t hour, int32_t minute, int32_t second));
    MOCK_METHOD3(onETAInfoResponse, Return<void>(int32_t hour, int32_t minute, int32_t second));
    MOCK_METHOD1(onMuteStatusNotification, Return<void>(ECallMute muteStatus));
    MOCK_METHOD1(onCallBackStatusNotification, Return<void>(int32_t remainTime));
    MOCK_METHOD1(onCallBackStatusResponse, Return<void>(int32_t remainTime));
    MOCK_METHOD1(onRemoteBookChrgnInfoNotification,
                 Return<void>(const RemoteBookChrgnInfo& remoteBookChrgn));
    MOCK_METHOD1(onExternalTcamIpResponse, Return<void>(const IpAddress& ipAddress));
    MOCK_METHOD1(onExternalTcamIpNotify, Return<void>(const IpAddress& ipAddress));
    MOCK_METHOD1(onSlaveTcamExtIpNotifyCyclic,
                 Return<void>(const hidl_vec<IpAddress>& ipAddressList));
    MOCK_METHOD1(onMasterTcamExtIpNotifyCyclic,
                 Return<void>(const hidl_vec<IpAddress>& ipAddressList));
    MOCK_METHOD1(onLightShowModeNotifyCyclic, Return<void>(LightShowMode lightShowMode));
    MOCK_METHOD1(onChargingResponse,
                 Return<void>(const SettingParamsRequestResponse& settingParamsRequestResponse));

    // Info error callback
    MOCK_METHOD0(onRemoteBookChrgnError, Return<void>());
    MOCK_METHOD0(onXCallStatusError, Return<void>());
    MOCK_METHOD0(onIHUStatusReportError, Return<void>());
    MOCK_METHOD0(onXCallControlError, Return<void>());
    MOCK_METHOD0(onCallcenterPreError, Return<void>());
    MOCK_METHOD0(onMUTECommandError, Return<void>());
    MOCK_METHOD0(onPremiumAudioError, Return<void>());
    MOCK_METHOD0(onCallBackStatusError, Return<void>());
    MOCK_METHOD0(onETAInfoError, Return<void>());
    MOCK_METHOD0(onRVDCLanguageStatusError, Return<void>());
    MOCK_METHOD0(onPOIInfoPushError, Return<void>());
    MOCK_METHOD0(onPrivateLockError, Return<void>());
    MOCK_METHOD0(onPrivateLockPasswordError, Return<void>());
    MOCK_METHOD0(onRVDCAuthorizationStatusError, Return<void>());
    MOCK_METHOD0(onRVDCAuthorizationStatusUserUpdateError, Return<void>());
    MOCK_METHOD0(onLocalBookChrgnError, Return<void>());
    MOCK_METHOD0(onChargingResponseError, Return<void>());
    MOCK_METHOD0(onPlayChatVideoLiveviewError, Return<void>());
    MOCK_METHOD0(onStopChatVideoLiveviewError, Return<void>());
    MOCK_METHOD0(onSecRowFaceInfoUploadFbError, Return<void>());
    MOCK_METHOD0(onSecRowFaceRecognitionReqError, Return<void>());
    MOCK_METHOD0(onSecRowFaceSgnInPictureCenterError, Return<void>());
    MOCK_METHOD0(onSecRowFaceSgnInPictureReError, Return<void>());

    MOCK_METHOD3(onRVDCAuthorizationStatusResponse,
                 Return<void>(Collectfunction collectFunction, Datacollection dataCollection,
                              Remotediagnostics remoteDiagnostics));
    MOCK_METHOD3(onRVDCAuthorizationStatusNotification,
                 Return<void>(Collectfunction collectFunction, Datacollection dataCollection,
                              Remotediagnostics remoteDiagnostics));
    MOCK_METHOD3(onRVDCAuthorizationStatusUserUpdateResponse,
                 Return<void>(Collectfunction collectFunction, Datacollection dataCollection,
                              Remotediagnostics remoteDiagnostics));

    MOCK_METHOD1(onBookTravelResponse,
                 Return<void>(const BookTravelGetResponse& bookTravel));
    MOCK_METHOD1(onBookTravelSetResponse,
                 Return<void>(BookTravelSetResponse bookTravelGetResponse));
    MOCK_METHOD1(onRemoteBookTrvlSetgSyncnResponse,
                 Return<void>(const BookTravelGetResponse& bookTravelGetResponses));
    MOCK_METHOD1(onChargeStartTimeSync,
                 Return<void>(const BookTravelGetResponse& bookTravelGetResponses));
    MOCK_METHOD1(onBookChargingResponse_Use0x23,
                 Return<void>(const BookChargingGetResponse& bookChargingGetResponse));
    MOCK_METHOD1(onBookChargingResponse_Use0x1D,
                 Return<void>(const BookChargingGetResponse& bookChargingGetResponse));
    MOCK_METHOD1(onBookChargingSetResponse_Use0x22,
                 Return<void>(BookChargingSetResponse bookChargingSetResponse));
    MOCK_METHOD1(onBookChargingSetResponse_Use0x1C,
                 Return<void>(BookChargingSetResponse bookChargingSetResponse));
    MOCK_METHOD1(onRemoteBookChrgnSetSynNotification_Use0x24,
                 Return<void>(const BookChargingGetResponse& bookChargingGetResponse));
    MOCK_METHOD1(onRemoteBookChrgnSetSynNotification_Use0x20,
                 Return<void>(const BookChargingGetResponse& bookChargingGetResponse));

    MOCK_METHOD2(onSecRowFaceInfoUploadFb,
                 Return<void>(const SecRowFaceInfoUploadSts secRowFaceInfoUploadSts, const SecRowfaceInfoAcqGid& secRowfaceInfoAcqGid));
    MOCK_METHOD2(NotifyOpSecRowFaceRecognitionReq,
                 Return<void>(const SecRowFaceInfoRespGid& secRowFaceInfoRespGid, const SecRowFaceInfoResp& secRowFaceInfoResp));
    MOCK_METHOD1(responseSecRowFaceSgnInPictureRe,
                 Return<void>(const SecondRowfaceInfosynSts secondRowfaceInfosynSts));
    MOCK_METHOD1(requestSecRowFaceSgnInPictureCenter,
                 Return<void>(const FirstRowfaceInfosynImg& firstRowfaceInfosynImg));

    // Request
    MOCK_METHOD0(requestPremiumAudio, Return<StatusCode>());
    MOCK_METHOD1(requestPrivateLock, Return<StatusCode>(PrivateLockCtrlReq privateLockCtrlReq));
    MOCK_METHOD1(requestPrivatePassword, Return<StatusCode>(const hidl_string& password));
    MOCK_METHOD1(requestPlayChatVideoLiveview, Return<StatusCode>(const hidl_string& serverUri));
    MOCK_METHOD0(requestStopChatVideoLiveview, Return<StatusCode>());
};

class TcamTest : public ::testing::Test {
   protected:
    virtual void SetUp() {
        mTcam = new Tcam();
        mCallback = new TcamCallbackTest();
       BookTravelGetResponse setBookTravelInfo;
    }

    virtual void TearDown() {
        if (mTcam != nullptr) {
            mTcam = nullptr;
        }

        if (mCallback != nullptr) {
            mCallback = nullptr;
        }
    }

    void testCallback() {
        // Data init
        char test[] = "test";
        CallType callType = CallType::ECall_SOS;
        CallStatus callStatus = CallStatus::CallStart;
        CallBackMode callbackMode = CallBackMode::Normal;
        ECallMute eCallMuteStatus = ECallMute::Mute;
        RemoteBookChrgnInfo remoteBookChrgnInfo;
        remoteBookChrgnInfo.remoteBookChrgn = RemoteBookChrgn::OFF;
        remoteBookChrgnInfo.startTime.year = 2019;
        remoteBookChrgnInfo.startTime.month = 12;
        remoteBookChrgnInfo.startTime.day = 12;
        remoteBookChrgnInfo.startTime.hour = 12;
        remoteBookChrgnInfo.startTime.minute = 12;
        remoteBookChrgnInfo.startTime.second = 12;
        remoteBookChrgnInfo.stopTime.year = 2019;
        remoteBookChrgnInfo.stopTime.month = 12;
        remoteBookChrgnInfo.stopTime.day = 12;
        remoteBookChrgnInfo.stopTime.hour = 12;
        remoteBookChrgnInfo.stopTime.minute = 13;
        remoteBookChrgnInfo.stopTime.second = 13;
        Collectfunction collectFunction = Collectfunction::enabled;
        Datacollection dataCollection = Datacollection::enabled;
        Remotediagnostics remoteDiagnostics = Remotediagnostics::enabled;
        BookTravelGetResponse bookTravel;
        BookChargingGetResponse bookChargingGetResponse;
        SecRowFaceInfoUploadSts secRowFaceInfoUploadSts = SecRowFaceInfoUploadSts::success;
        SecRowfaceInfoAcqGid secRowfaceInfoAcqGid;
        SecRowFaceInfoRespGid secRowFaceInfoRespGid;
        SecRowFaceInfoResp secRowFaceInfoResp;
        SecondRowfaceInfosynSts secondRowfaceInfosynSts = SecondRowfaceInfosynSts::success;
        FirstRowfaceInfosynImg firstRowfaceInfosynImg;

        mCallback->onPOIInfoNotification(hidl_string(test), 88888888, 88888888, hidl_string(test),
                                         hidl_string(test), hidl_string(test), hidl_string(test),
                                         hidl_string(test), hidl_string(test));
        mCallback->onXcallStatusNotification(callType, callStatus, callbackMode);
        mCallback->onXcallStatusResponse(callType, callStatus, callbackMode);
        mCallback->onETAInfoResponse(12, 12, 12);
        mCallback->onETAInfoNotification(12, 12, 12);
        mCallback->onMuteStatusNotification(eCallMuteStatus);
        mCallback->onCallBackStatusNotification(12);
        mCallback->onCallBackStatusResponse(12);

        mCallback->onRemoteBookChrgnInfoNotification(remoteBookChrgnInfo);
        mCallback->requestPremiumAudio();
        mCallback->requestPrivateLock(PrivateLockCtrlReq::req_default);
        mCallback->requestPrivatePassword(hidl_string(test));
        mCallback->requestPlayChatVideoLiveview(hidl_string(test));
        mCallback->requestStopChatVideoLiveview();
        mCallback->onRVDCAuthorizationStatusResponse(collectFunction, dataCollection,
                                                     remoteDiagnostics);
        mCallback->onRVDCAuthorizationStatusNotification(collectFunction, dataCollection,
                                                         remoteDiagnostics);
        mCallback->onRVDCAuthorizationStatusUserUpdateResponse(collectFunction, dataCollection,
                                                               remoteDiagnostics);
        mCallback->onLocalBookChrgnError();
        mCallback->onRemoteBookChrgnError();
        mCallback->onXCallStatusError();
        mCallback->onIHUStatusReportError();
        mCallback->onMUTECommandError();
        mCallback->onXCallControlError();
        mCallback->onCallcenterPreError();
        mCallback->onPremiumAudioError();
        mCallback->onCallBackStatusError();
        mCallback->onETAInfoError();
        mCallback->onRVDCLanguageStatusError();
        mCallback->onPOIInfoPushError();
        mCallback->onPrivateLockError();
        mCallback->onPrivateLockPasswordError();
        mCallback->onRVDCAuthorizationStatusError();
        mCallback->onRVDCAuthorizationStatusUserUpdateError();
        mCallback->onPlayChatVideoLiveviewError();
        mCallback->onStopChatVideoLiveviewError();
        mCallback->onSecRowFaceInfoUploadFbError();
        mCallback->onSecRowFaceRecognitionReqError();
        mCallback->onSecRowFaceSgnInPictureCenterError();
        mCallback->onSecRowFaceSgnInPictureReError();
        mCallback->onBookTravelResponse(bookTravel);
        mCallback->onBookTravelSetResponse(BookTravelSetResponse::success);
        mCallback->onRemoteBookTrvlSetgSyncnResponse(bookTravel);
        mCallback->onChargeStartTimeSync(bookTravel);
        mCallback->onBookChargingResponse_Use0x23(bookChargingGetResponse);
        mCallback->onBookChargingResponse_Use0x1D(bookChargingGetResponse);
        mCallback->onBookChargingSetResponse_Use0x22(BookChargingSetResponse::success);
        mCallback->onBookChargingSetResponse_Use0x1C(BookChargingSetResponse::success);
        mCallback->onRemoteBookChrgnSetSynNotification_Use0x24(bookChargingGetResponse);
        mCallback->onRemoteBookChrgnSetSynNotification_Use0x20(bookChargingGetResponse);
        mCallback->onSecRowFaceInfoUploadFb(secRowFaceInfoUploadSts, secRowfaceInfoAcqGid);
        mCallback->NotifyOpSecRowFaceRecognitionReq(secRowFaceInfoRespGid, secRowFaceInfoResp);
        mCallback->responseSecRowFaceSgnInPictureRe(secondRowfaceInfosynSts);
        mCallback->requestSecRowFaceSgnInPictureCenter(firstRowfaceInfosynImg);
    }
    sp<Tcam> mTcam;
    sp<TcamCallbackTest> mCallback;
};

TEST_F(TcamTest, GetTcamInstance) {
    sleep(DELAY_TIME);
    ASSERT_NE(Tcam::getTcam(), nullptr);
}

TEST_F(TcamTest, TestTcamHAlServiceProvideMethod) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestXCallStatus());
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestExternalTcamIp());
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestCallbackRemainTime());
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestETAInfo());
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->subscribe(mCallback));

    ASSERT_EQ(StatusCode::SUCCESS, mTcam->notifyLanguageStatus(LanguageType::chineseTradCan));
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->notifyIHUStatusReport(IHUStatusCommand::HUStart));
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->notifyXCallControl(HangupCall::RingXcall, CallType::ECall_SOS));
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->responsePremiumAudioStatus(GenericStatus::ok, GenericStatus::ok));
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->responsePrivateLockPassword(PrivateLockPasswordResp::success));
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->responsePrivateLockCtrlResp(PrivateLockCtrlResp::success));
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestRVDCAuthorizationStatus());
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->setRequestRVDCAuthorizationStatusUserUpdate(
                  Collectfunction::enabled, Datacollection::enabled, Remotediagnostics::enabled));
    ASSERT_TRUE(mTcam->getCallback());
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->unsubscribe(mCallback));
    sleep(DELAY_TIME);

    LocalBookChrgnInfo localBookChrgnInfo;
    localBookChrgnInfo.localBookChrgnStatus = LocalBookChrgnStatus::On;
    localBookChrgnInfo.startTime.dataOrTi = DateOrTime::Date;
    localBookChrgnInfo.startTime.year = 2019;
    localBookChrgnInfo.startTime.month = 12;
    localBookChrgnInfo.startTime.day = 12;
    localBookChrgnInfo.startTime.hour = 12;
    localBookChrgnInfo.startTime.minute = 12;
    localBookChrgnInfo.startTime.second = 12;
    localBookChrgnInfo.stopTime.year = 2019;
    localBookChrgnInfo.stopTime.month = 12;
    localBookChrgnInfo.stopTime.day = 12;
    localBookChrgnInfo.stopTime.hour = 12;
    localBookChrgnInfo.stopTime.minute = 13;
    localBookChrgnInfo.stopTime.second = 13;
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->notifyLocalChrgnInfo(localBookChrgnInfo));
    sleep(DELAY_TIME);
}

TEST_F(TcamTest, TestCallback) {
    sleep(DELAY_TIME);
    CallType callType = CallType::ECall_SOS;
    EXPECT_CALL(*mCallback, onRemoteBookChrgnError()).Times(1);
    EXPECT_CALL(*mCallback, onXCallStatusError()).Times(1);
    EXPECT_CALL(*mCallback, onIHUStatusReportError()).Times(1);
    EXPECT_CALL(*mCallback, onXCallControlError()).Times(1);
    EXPECT_CALL(*mCallback, onCallcenterPreError()).Times(1);
    EXPECT_CALL(*mCallback, onMUTECommandError()).Times(1);
    EXPECT_CALL(*mCallback, onPremiumAudioError()).Times(1);
    EXPECT_CALL(*mCallback, onCallBackStatusError()).Times(1);
    EXPECT_CALL(*mCallback, onETAInfoError()).Times(1);
    EXPECT_CALL(*mCallback, onRVDCLanguageStatusError()).Times(1);
    EXPECT_CALL(*mCallback, onPOIInfoPushError()).Times(1);
    EXPECT_CALL(*mCallback, onPrivateLockError()).Times(1);
    EXPECT_CALL(*mCallback, onPrivateLockPasswordError()).Times(1);
    EXPECT_CALL(*mCallback, onRVDCAuthorizationStatusError()).Times(1);
    EXPECT_CALL(*mCallback, onRVDCAuthorizationStatusUserUpdateError()).Times(1);
    EXPECT_CALL(*mCallback, onLocalBookChrgnError()).Times(1);
    EXPECT_CALL(*mCallback, onPlayChatVideoLiveviewError()).Times(1);
    EXPECT_CALL(*mCallback, onStopChatVideoLiveviewError()).Times(1);
    EXPECT_CALL(*mCallback, onSecRowFaceInfoUploadFbError()).Times(1);
    EXPECT_CALL(*mCallback, onSecRowFaceRecognitionReqError()).Times(1);
    EXPECT_CALL(*mCallback, onSecRowFaceSgnInPictureCenterError()).Times(1);
    EXPECT_CALL(*mCallback, onSecRowFaceSgnInPictureReError()).Times(1);
    EXPECT_CALL(*mCallback, onPOIInfoNotification(_, _, _, _, _, _, _, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onXcallStatusNotification(callType, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onXcallStatusResponse(_, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onETAInfoNotification(_, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onETAInfoResponse(_, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onMuteStatusNotification(_)).Times(1);
    EXPECT_CALL(*mCallback, onCallBackStatusNotification(_)).Times(1);
    EXPECT_CALL(*mCallback, onCallBackStatusResponse(_)).Times(1);
    EXPECT_CALL(*mCallback, onRemoteBookChrgnInfoNotification(_)).Times(1);
    EXPECT_CALL(*mCallback, requestPremiumAudio())
        .Times(1)
        .WillRepeatedly(testing::Return(ByMove(Return<StatusCode>(StatusCode::SUCCESS))));
    EXPECT_CALL(*mCallback, requestPrivateLock(_))
        .Times(1)
        .WillRepeatedly(testing::Return(ByMove(Return<StatusCode>(StatusCode::SUCCESS))));
    EXPECT_CALL(*mCallback, requestPrivatePassword(_))
        .Times(1)
        .WillRepeatedly(testing::Return(ByMove(Return<StatusCode>(StatusCode::SUCCESS))));
    EXPECT_CALL(*mCallback, requestPlayChatVideoLiveview(_))
        .Times(1)
        .WillRepeatedly(testing::Return(ByMove(Return<StatusCode>(StatusCode::SUCCESS))));
    EXPECT_CALL(*mCallback, requestStopChatVideoLiveview())
        .Times(1)
        .WillRepeatedly(testing::Return(ByMove(Return<StatusCode>(StatusCode::SUCCESS))));
    EXPECT_CALL(*mCallback, onRVDCAuthorizationStatusResponse(_, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onRVDCAuthorizationStatusNotification(_, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onRVDCAuthorizationStatusUserUpdateResponse(_, _, _)).Times(1);
    EXPECT_CALL(*mCallback, onExternalTcamIpNotify(_)).Times(0);
    EXPECT_CALL(*mCallback, onSlaveTcamExtIpNotifyCyclic(_)).Times(0);
    EXPECT_CALL(*mCallback, onMasterTcamExtIpNotifyCyclic(_)).Times(0);
    EXPECT_CALL(*mCallback, onLightShowModeNotifyCyclic(_)).Times(0);
    EXPECT_CALL(*mCallback, onExternalTcamIpResponse(_)).Times(0);
    EXPECT_CALL(*mCallback, onBookTravelResponse(_)).Times(1);
    EXPECT_CALL(*mCallback, onBookTravelSetResponse(_)).Times(1);
    EXPECT_CALL(*mCallback, onRemoteBookTrvlSetgSyncnResponse(_)).Times(1);
    EXPECT_CALL(*mCallback, onChargeStartTimeSync(_)).Times(1);
    EXPECT_CALL(*mCallback, onBookChargingResponse_Use0x23(_)).Times(1);
    EXPECT_CALL(*mCallback, onBookChargingResponse_Use0x1D(_)).Times(1);
    EXPECT_CALL(*mCallback, onBookChargingSetResponse_Use0x22(_)).Times(1);
    EXPECT_CALL(*mCallback, onBookChargingSetResponse_Use0x1C(_)).Times(1);
    EXPECT_CALL(*mCallback, onRemoteBookChrgnSetSynNotification_Use0x24(_)).Times(1);
    EXPECT_CALL(*mCallback, onRemoteBookChrgnSetSynNotification_Use0x20(_)).Times(1);
    EXPECT_CALL(*mCallback, onSecRowFaceInfoUploadFb(_, _)).Times(1);
    EXPECT_CALL(*mCallback, NotifyOpSecRowFaceRecognitionReq(_, _)).Times(1);
    EXPECT_CALL(*mCallback, responseSecRowFaceSgnInPictureRe(_)).Times(1);
    EXPECT_CALL(*mCallback, requestSecRowFaceSgnInPictureCenter(_)).Times(1);

    sleep(DELAY_TIME);
    testCallback();
}

#ifdef DEBUG_INFO
TEST_F(TcamTest, RequestCallbackRemainTime) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestCallbackRemainTime());
}

TEST_F(TcamTest, RequestETAInfo) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestETAInfo());
}

TEST_F(TcamTest, Subscribe) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->subscribe(mCallback));
}

TEST_F(TcamTest, Unsubscribe) {
    sleep(DELAY_TIME);
    mTcam->subscribe(mCallback);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->unsubscribe(mCallback));
}

TEST_F(TcamTest, NotifyLocalChrgnInfo) {
    sleep(DELAY_TIME);
    LocalBookChrgnInfo localBookChrgnInfo;
    localBookChrgnInfo.localBookChrgnStatus = LocalBookChrgnStatus::On;
    localBookChrgnInfo.startTime.dataOrTi = DateOrTime::Date;
    localBookChrgnInfo.startTime.year = 2019;
    localBookChrgnInfo.startTime.month = 12;
    localBookChrgnInfo.startTime.day = 12;
    localBookChrgnInfo.startTime.hour = 12;
    localBookChrgnInfo.startTime.minute = 12;
    localBookChrgnInfo.startTime.second = 12;
    localBookChrgnInfo.stopTime.year = 2019;
    localBookChrgnInfo.stopTime.month = 12;
    localBookChrgnInfo.stopTime.day = 12;
    localBookChrgnInfo.stopTime.hour = 12;
    localBookChrgnInfo.stopTime.minute = 13;
    localBookChrgnInfo.stopTime.second = 13;
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->notifyLocalChrgnInfo(localBookChrgnInfo));
}

TEST_F(TcamTest, NotifyLanguageStatus) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->notifyLanguageStatus(LanguageType::chineseTradCan));
}

TEST_F(TcamTest, NotifyIHUStatusReport) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->notifyIHUStatusReport(IHUStatusCommand::HUStart));
}

TEST_F(TcamTest, NotifyXCallControl) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->notifyXCallControl(HangupCall::RingXcall, CallType::ECall_SOS));
}

TEST_F(TcamTest, ResponsePremiumAudioStatus) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->responsePremiumAudioStatus(GenericStatus::ok, GenericStatus::ok));
}

TEST_F(TcamTest, ResponsePrivateLockPassword) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->responsePrivateLockPassword(PrivateLockPasswordResp::success));
}

TEST_F(TcamTest, ResponsePrivateLockCtrlResp) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->responsePrivateLockCtrlResp(PrivateLockCtrlResp::success));
}

TEST_F(TcamTest, RequestRVDCAuthorizationStatus) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS, mTcam->requestRVDCAuthorizationStatus());
}

TEST_F(TcamTest, SetRequestRVDCAuthorizationStatusUserUpdate) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->setRequestRVDCAuthorizationStatusUserUpdate(
                  Collectfunction::enabled, Datacollection::enabled, Remotediagnostics::enabled));
}

TEST_F(TcamTest, RequestBookTravel) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->RequestBookTravel(
                  BookTravelGet::bookTravelGet));
}

TEST_F(TcamTest, setBookTravel) {
    sleep(DELAY_TIME);
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->setBookTravel(
                  setBookTravelInfo));
}

TEST_F(TcamTest, GetCallback) {
    sleep(DELAY_TIME);
    mTcam->subscribe(mCallback);
    ASSERT_TRUE(mTcam->getCallback());
}
#endif
//E371 23R1 23R2U2
TEST_F(TcamTest, setBookCharging_Use0x1C) {
    sleep(DELAY_TIME);
    BookChargingGetResponse setBookChargeInfo;
    setBookChargeInfo.reservationChrgnSwitchSts = ReservationChrgnSwitchSts::single;
    setBookChargeInfo.reservationStrtTiChrgnTmrPresent = 1;
    setBookChargeInfo.reservationStopTiChrgnTmrPresent = 1;
    setBookChargeInfo.priorityFullSwitchStsPresent = 1;
    setBookChargeInfo.reservationStrtTiChrgnTmr.dataOrTi = DateOrTime::Date_Ti;
    setBookChargeInfo.reservationStrtTiChrgnTmr.year = 2023;
    setBookChargeInfo.reservationStrtTiChrgnTmr.month = 10;
    setBookChargeInfo.reservationStrtTiChrgnTmr.day = 13;
    setBookChargeInfo.reservationStrtTiChrgnTmr.hour = 18;
    setBookChargeInfo.reservationStrtTiChrgnTmr.minute = 12;
    setBookChargeInfo.reservationStrtTiChrgnTmr.second = 12;
    setBookChargeInfo.reservationStopTiChrgnTmr.dataOrTi = DateOrTime::Date_Ti;
    setBookChargeInfo.reservationStopTiChrgnTmr.year = 2023;
    setBookChargeInfo.reservationStopTiChrgnTmr.month = 10;
    setBookChargeInfo.reservationStopTiChrgnTmr.day = 13;
    setBookChargeInfo.reservationStopTiChrgnTmr.hour = 20;
    setBookChargeInfo.reservationStopTiChrgnTmr.minute = 13;
    setBookChargeInfo.reservationStopTiChrgnTmr.second = 13;
    setBookChargeInfo.priorityFullSwitchSts = SwtSts::off;
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->setBookCharging_Use0x1C(
                  setBookChargeInfo));
}

//E371 23R1 23R2U2
TEST_F(TcamTest, requestBookChargeInfo_Use0x1D) {
    sleep(DELAY_TIME);
    BookChargingGet bookChargingGet;
    bookChargingGet = BookChargingGet::setgGet;
    ASSERT_EQ(StatusCode::SUCCESS,
              mTcam->requestBookChargeInfo_Use0x1D(
                  bookChargingGet));
}

}  // namespace gtest
}  // namespace V1_0
}  // namespace tcam
}  // namespace xma
}  // namespace ecarx
}  // namespace vendor

int main(int ac, char* av[]) {
    testing::InitGoogleMock(&ac, av);
    return RUN_ALL_TESTS();
}
